package com.fly.caihong.adapter;

import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.fly.caihong.R;
import com.fly.caihong.model.MessageItem;
import com.fly.caihong.utils.ApUtils;
import com.fly.caihong.utils.GlideUtils;

import java.util.List;

public class MessageAdapter extends BaseQuickAdapter<MessageItem, BaseViewHolder> {
    public MessageAdapter(@Nullable List<MessageItem> data) {
        super(R.layout.layout_conversation_item, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, MessageItem item) {
        helper.setText(R.id.conversationTitle, item.getName()).setText(R.id.dialogLastMessage, item.getContent());
        GlideUtils.loadCircleAvatar(ApUtils.getApp(), (ImageView) helper.getView(R.id.dialogAvatar), item.getPhoto());
    }
}
